# 103. 日期问题
# https://www.lanqiao.cn/problems/103/learning/?page=1&first_category_id=1&second_category_id=3&contain_answer=true
# Date: 2025/2/4


def unformat_data(inp_date):
    def is_month(month: int):
        """
        判断月份是否合法
        """
        return 1 <= month <= 12

    def is_day(year, month, day):
        """
        根据年月日判断日期是否合法
        """
        year = year_format(year)
        if month in [1, 3, 5, 7, 8, 10, 12]:  # 大月
            return 1 <= day <= 31
        elif month in [4, 6, 9, 11]:  # 小月
            return 1 <= day <= 30
        elif month == 2:  # 二月
            if is_leap_year(year):
                return 1 <= day <= 29
            else:
                return 1 <= day <= 28
        else:
            return False

    def year_format(year: int):
        if year >= 60:
            return 1900 + year
        else:
            return 2000 + year

    def is_leap_year(year):
        """
        判断给定的年份是否为闰年
        :param year: 要判断的年份
        :return: 如果是闰年返回 True，否则返回 False
        """
        return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)

    def md_format(num: int):
        if num < 10:
            return "0" + str(num)
        else:
            return str(num)

    a, b, c = map(int, inp_date.split('/'))
    res = set()
    if is_month(a) and is_day(year=c, month=a, day=b):  # 月/日/年
        res.add(str(year_format(c)) + "-" + md_format(a) + "-" + md_format(b))

    if is_month(b):
        if is_day(year=a, month=b, day=c):  # 年/月/日
            res.add(str(year_format(a)) + "-" + md_format(b) + "-" + md_format(c))
        if is_day(year=c, month=b, day=a):  # 日/月/年
            res.add(str(year_format(c)) + "-" + md_format(b) + "-" + md_format(a))

    return sorted(res)


if __name__ == '__main__':
    # inp = input()
    for item in unformat_data("02/03/04"):
        print(item)
    print("=" * 25)

    for item in unformat_data("04/02/29"):
        print(item)
    print("=" * 25)

    for item in unformat_data("10/11/12"):
        print(item)
